/*
 * Copyright (c)$today.year.month.day
 *  admin:郑程荣.
 *  文件名:DeviceInfoActivity.java
 *  项目功能:
 */

package com.jg.myproject.module.deviceinfo;


import com.allen.library.SuperTextView;
import com.jg.myproject.api.Const;
import com.jg.myproject.api.bean.BaseEntity;
import com.jg.myproject.api.bean.CommonRequestBean;
import com.jg.myproject.api.bean.reponse.CommonReponseBean;
import com.jg.myproject.module.base.BaseActivity;
import com.jg.myproject.module.warninfo.WarnInfoActivity;
import com.jg.myproject.presenter.DeviceInfoPresenter;
import com.jg.myproject.pview.IDeviceInfoView;
import com.jg.myproject.utils.RxSPTool;
import com.zcr.myproject.R;

import butterknife.BindView;

/**
 * Created by llz on 2018/11/21.
 */
public class DeviceInfoActivity extends BaseActivity implements IDeviceInfoView {
    @BindView(R.id.stv_01)
    SuperTextView mStv01;
    @BindView(R.id.stv_02)
    SuperTextView mStv02;
    @BindView(R.id.stv_03)
    SuperTextView mStv03;
    @BindView(R.id.stv_04)
    SuperTextView mStv04;
    @BindView(R.id.stv_05)
    SuperTextView mStv05;
    @BindView(R.id.stv_06)
    SuperTextView mStv06;
    @BindView(R.id.stv_07)
    SuperTextView mStv07;
    @BindView(R.id.stv_08)
    SuperTextView mStv08;
    @BindView(R.id.stv_09)
    SuperTextView mStv09;
    @BindView(R.id.stv_10)
    SuperTextView mStv10;
    @BindView(R.id.stv_11)
    SuperTextView mStv11;
    @BindView(R.id.stv_12)
    SuperTextView mStv12;
    @BindView(R.id.stv_13)
    SuperTextView mStv13;

    DeviceInfoPresenter mDeviceInfoPresenter;
    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_device_info;
    }

    @Override
    protected void initViews() {
        initTitle(true, "设备信息");//2.初始化工作
        mDeviceInfoPresenter = new DeviceInfoPresenter(this);
        CommonRequestBean commonRequestBean = new CommonRequestBean(); // 3.1组织请求的数据
        String id = RxSPTool.getString(this,Const.PROJECTID);
        String monitorPartId = RxSPTool.getString(this,Const.MONITORPARTID);
        String monitorPartCode = RxSPTool.getString(this,Const.MONITORPARTCODE);
        commonRequestBean.setGcId(id);
        commonRequestBean.setMonitorPartId(monitorPartId);
        commonRequestBean.setMonitorPartCode(monitorPartCode);
        String userId = RxSPTool.getString(DeviceInfoActivity.this,Const.USERID);
        commonRequestBean.setUserId(userId);
        mDeviceInfoPresenter.getData(commonRequestBean);
    }

    @Override
    protected void updateViews(boolean isRefresh) {

    }

    @Override
    public void getReponseBeans(BaseEntity<CommonReponseBean> bean) {
        CommonReponseBean commonReponseBean1 = bean.getBeans().get(0);
        mStv11.setCenterString(commonReponseBean1.getGcName());
        mStv12.setCenterString(commonReponseBean1.getMonitorPartCode());
        mStv13.setCenterString(commonReponseBean1.getMonitorPartName());
        CommonReponseBean.CommonReponseChildBean commonReponseChildBean = commonReponseBean1.getDeviceList().get(0);
        mStv01.setCenterString(commonReponseChildBean.getName());
        mStv02.setCenterString(commonReponseChildBean.getDeviceCode());
        mStv03.setCenterString(commonReponseChildBean.getFactoryCode());
        mStv04.setCenterString(commonReponseChildBean.getModel());
        mStv05.setCenterString(commonReponseChildBean.getFactory());
        mStv06.setCenterString(commonReponseChildBean.getAdjustorgan());
        mStv07.setCenterString(commonReponseChildBean.getAdjustdate());
        mStv08.setCenterString(commonReponseChildBean.getValidity());
        mStv09.setCenterString(commonReponseChildBean.getArea());
        mStv10.setCenterString(commonReponseChildBean.getState());

    }


}
